//
//  LeftViewController.m
//  soccer
//
//  Created by 上官千城 on 15/9/2.
//  Copyright (c) 2015年 上官千城. All rights reserved.
//

#import "LeftViewController.h"

@interface LeftViewController ()

@end

@implementation LeftViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    //创建tableView
    self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT) style:UITableViewStylePlain];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.backgroundColor = [UIColor blackColor];
    [self.view addSubview:self.tableView];
    //头部View
    LeftHeardView *view = [[LeftHeardView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, 200)];
    view.backgroundColor = [UIColor blackColor];
    self.tableView.tableHeaderView = view;
    //脚部View
    UIView *footView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT - view.frame.size.height - self.tableView.frame.size.height)];
    footView.backgroundColor = [UIColor blackColor];
    
    UIImageView *footImage = [[UIImageView alloc]initWithFrame:CGRectMake(40, footView.frame.size.height-280, 150, 60)];
//    footImage.backgroundColor = [UIColor cyanColor];
    footImage.image = [UIImage imageNamed:@"logo.jpg"];
    [footView addSubview:footImage];
    
    self.tableView.tableFooterView = footView;
    
}
//tableView 协议方法
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellInfo = @"leftCell";
    leftTableCell *cell = [tableView dequeueReusableCellWithIdentifier:cellInfo];
    if (cell == nil) {
        cell = [[leftTableCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellInfo];
    }
    if (indexPath.row == 0) {
        UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 40, 40)];
//        image.backgroundColor = [UIColor orangeColor];
        image.image = [UIImage imageNamed:@"111.jpg"];
        [cell addSubview:image];
    }
    if (indexPath.row == 1) {
        UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 40, 40)];
//        image.backgroundColor = [UIColor orangeColor];
        image.image = [UIImage imageNamed:@"222.jpg"];
        [cell addSubview:image];
    }
    if (indexPath.row == 2) {
        UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 40, 40)];
//        image.backgroundColor = [UIColor orangeColor];
        image.image = [UIImage imageNamed:@"333.jpg"];
        [cell addSubview:image];
    }
    if (indexPath.row == 3) {
        UIImageView *image = [[UIImageView alloc]initWithFrame:CGRectMake(10, 10, 40, 40)];
//        image.backgroundColor = [UIColor orangeColor];
        image.image = [UIImage imageNamed:@"444.jpg"];
        [cell addSubview:image];
    }
    NSMutableArray *arrayName = [NSMutableArray arrayWithObjects:@"          积分榜射手榜", @"          比赛提醒",@"           转会动态", @"           球员场上数据",nil];
    [cell.textLabel setText:[arrayName objectAtIndex:indexPath.row]];
    cell.textLabel.textColor = [UIColor whiteColor];
    cell.backgroundColor = [UIColor blackColor];
    return cell;
}
//设置行高

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60;
}
//设置行数
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 4;

}
//点击行触发方法
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0 ) {
        NSLog(@"数据显示");
    }
    if (indexPath.row == 1) {
        NSLog(@"转会");
    }
    if (indexPath.row == 2) {
        NSLog(@"提醒");
    }
    if (indexPath.row == 3) {
        NSLog(@"球员数据")
    }
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
